#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

int c[1001];
int idx[1001];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        c[a] += 1;
    }

    for(int i = 0; i < 1001; i++){
        int m = 0;
        int idx2 = 0;
        for(int j = 0; j <= 1001; j++){
            if(c[j] > m){
                m = c[j];
                idx2 = j;
            }
        }
        c[idx2] = 0;
        idx[i] = idx2;
    }

    for(int i = 0; i < 1001; i++){
        if(idx[i]!=0){
            cout << idx[i];
            if(idx[i+1] != 0){
                cout << "->";
            }
        }
    }
    return 0;
}